package com.itheima.dao.store;

import com.itheima.domain.store.Product;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: My.zheng
 * @Description:
 * @Date: Created in 21:58  2020/11/29
 * @ModifiedBy:
 */
public interface ProductDao {
    /**
     * @Description: 添加
     * @Param: [product]
     * @return: int
     * @Author: My.zheng
     * @Date: 2020/11/29
     */
    int save(Product product);

    /**
     * @Description: 删除
     * @Param: [product]
     * @return: int
     * @Author: My.zheng
     * @Date: 2020/11/29
     */
    int delete(Product product);

    /**
     * @Description: 修改
     * @Param: [product]
     * @return: int
     * @Author: My.zheng
     * @Date: 2020/11/29
     */
    int update(Product product);

    /**
     * @Description: 查询所有
     * @Param: []
     * @return: java.util.List<com.itheima.domain.store.Product>
     * @Author: My.zheng
     * @Date: 2020/11/29
     */

    List<Product> findAll();



    /**
     * @Description: 按Id查询
     * @Param: [Id]
     * @return: com.itheima.domain.store.Product
     * @Author: My.zheng
     * @Date: 2020/11/29
     */
    Product findById(String id);

    /**
     * @Description: 模糊查询
     * @Param: [name]
     * @return: java.util.List<com.itheima.domain.store.Product>
     * @Author: My.zheng
     * @Date: 2020/11/30
     */
    List<Product> FuzzyEnquiryTime(String time);

    void deleteById(String id);

    @Update(" UPDATE product SET productStatus=1 WHERE id = #{id}")
    void dopen(String id);


    @Update("UPDATE product SET productStatus=0 WHERE id=#{id}")
    void paralyse(String id);
}
